package com.mililoan.common.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;

public abstract class AbstractBaseDao<T> {

	@Autowired
	private JdbcTemplate jdbcTemplate;

	/**
	 * 
	 * Description: 获取序列值
	 *
	 * @param p_seq
	 * @return
	 * @throws DataAccessException
	 */
	@SuppressWarnings("deprecation")
	public int getSeqNextVal(String p_seq) throws DataAccessException {

		String sql = "select nextval('" + p_seq + "') val from dual";

		return getJdbcTemplate().queryForInt(sql);
	}

	/**
	 * 获取 jdbcTemplate
	 * 
	 * @return jdbcTemplate
	 */
	public JdbcTemplate getJdbcTemplate() {
		return jdbcTemplate;
	}

}
